<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    
    <c:if test="${jarjarbean.userConnected == null}">
        <h:form id="titi">
            <h:panelGrid id="panel" columns="5" border="0" cellpadding="0" cellspacing="2">
            <h:outputLabel value="Votre email : "/>
            <h:inputText id="email" value="#{jarjarbean.email}"/>

            <h:outputLabel value="Votre mot de passe : "/>
            <h:inputSecret id="password" value="#{jarjarbean.password1}"/>

            <h:commandButton class="button" action="#{jarjarbean.login()}" value="Me connecter !"/>
            </h:panelGrid>
        </h:form>
            <h:outputText value="#{jarjarbean.errorLogin}" style="color: red"/>
    </c:if>
<!--    If a user is logged In-->
    <c:if test="${jarjarbean.userConnected != null}">
        Bienvenue ${jarjarbean.userConnected.pseudo}.
        <h:form>
            <h:commandButton class="button" action="#{jarjarbean.logOut()}" value="Se déconnecter"/>
            <h:commandButton class="button" action="#{jarjarbean.goToEditMyAccount()}" value="Modifier mon compte"/>
        </h:form>
    </c:if>
    
</ui:composition>